<template>
  <div class='container'>
    <Navbar title='兑换会员'></Navbar>
    <div class="user">
      <i>成功兑换后将关联到当前账号：</i> <span> {{userInfo.username}} </span>
    </div>
    <van-form @submit="onSubmit"
              class="form">
      <van-field v-model="formDate.carid"
                 name="卡号"
                 placeholder="请输入10位卡号" />
      <van-field v-model="formDate.cardpwd"
                 type="password"
                 name="卡密"
                 placeholder="请输入6位卡密" />
      <div style="margin: 16px;">
        <van-button block
                    :disabled='vipbtn'
                    type="info"
                    native-type="submit">兑换</van-button>
      </div>
    </van-form>
    <div class="footer">
      <h3>——温馨提示——</h3>
      <p>新兑换的会员服务，权益以「会员说明」为准。</p>
      <p>月卡：30次减免配送费。</p>
      <p>季卡：90次减免配送费。</p>
      <p>年卡：360次减免配送费。</p>
      <p>＊仅限蜂鸟专送订单，每日最多减免3单，每单最高减免4元（一个月按31天计算）</p>
    </div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: '',
  components: {},
  props: {},
  data () {
    return {
      formDate: {
        cardid: '',
        cardpwd: ''
      }
    }
  },
  computed: {
    ...mapState(['userInfo']),


    vipbtn () {
      if (this.formDate.cardid.length === 0 && this.formDate.cardpwd.length === 0) {
        return true
      } else {
        return false
      }
    }
  },
  methods: {
    onSubmit (values) {
      console.log('submit', values);
    }
  },
}
</script>

<style lang="less" scoped>
.container {
  .user {
    height: 25px;
    padding: 10px 20px;
    i {
      font-style: normal;
      font-size: 14px;
      color: #999;
    }
    span {
      color: #000;
      font-weight: 700;
    }
  }
  /deep/ .form {
    input::-webkit-input-placeholder {
      color: #666;
    }
    .van-button--info {
      border-radius: 6px;
    }
  }
  .footer {
    color: #aaa;
    font-size: 12px;
    h3 {
      font-size: 16px;
      text-align: center;
      margin-bottom: 10px;
      font-weight: 400;
    }
    p {
      padding-left: 40px;
      margin: 0;
      line-height: 21px;
    }
  }
}
</style>
